﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CourseUtils;

namespace Palyndrome
{
    class Program
    {
        static bool isPalyndrome(int number, int reverse )
        {
            bool result = true;
            if (number == reverse)
            {
                return result;
            }
            return !result;
        }

        static int reverseNumber(int number)
        {
            int reverse = 0;
            while (number > 0)
            {
                reverse *= 10;
                reverse += number % 10;
                number /= 10;
            }
            return reverse;
        }
        static void Main(string[] args)
        {
            int number = IOHelpers.ReadIntFromConsole("Enter number");

            if (isPalyndrome(number, reverseNumber(number)))
            {
                Console.WriteLine("Entered number {0} is a palyndrome", number);
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Entered number {0} is NOT a palyndrome", number);
                Console.ReadKey();
            }
        }
    }
}
